﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using StructureMap.Configuration.DSL;
using MyBBS.Services;
using MyBBS.Data.Interfaces;
using MyBBS.Data;
using StructureMap;

namespace MyBBS
{
    public static class BootStrapper
    {
        public static void ConfigureStructureMap() {
            StructureMapConfiguration.AddRegistry(new DBServiceRegistry());
            StructureMapConfiguration.AddRegistry(new PostRegistry());
        }
    }

    public class PostRegistry : Registry {
        protected override void configure() {
            
            ForRequestedType<IPostService>()
                .TheDefaultIsConcreteType<PostService>();
            
            ForRequestedType<IUserService>()
                .TheDefaultIsConcreteType<UserService>();

            ForRequestedType<IPostRepository>()
                .TheDefaultIsConcreteType<PostRepository>();

            ForRequestedType<IUserRepository>()
                .TheDefaultIsConcreteType<UserRepository>();

        }
    }
}
